using GoogleMobileAds.Common.Mediation.AppLovin;
using UnityEngine;

namespace GoogleMobileAds.Android.Mediation.AppLovin
{
	public class AppLovinClient : IAppLovinClient
	{
		private static AppLovinClient instance = new AppLovinClient();

		public static AppLovinClient Instance => instance;

		private AppLovinClient()
		{
		}

		public void Initialize()
		{
			MonoBehaviour.print("AppLovin intialize received");
			AndroidJavaObject @static = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
			new AndroidJavaClass("com.applovin.sdk.AppLovinSdk").CallStatic("initializeSdk", @static);
		}

		public void SetHasUserConsent(bool hasUserConsent)
		{
			AndroidJavaObject @static = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
			AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.applovin.sdk.AppLovinPrivacySettings");
			string str = hasUserConsent ? "true" : "false";
			MonoBehaviour.print("Calling 'AppLovinPrivacySettings.setHasUserConsent()' with argument: " + str);
			androidJavaClass.CallStatic("setHasUserConsent", hasUserConsent, @static);
		}

		public void SetIsAgeRestrictedUser(bool isAgeRestrictedUser)
		{
			AndroidJavaObject @static = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
			AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.applovin.sdk.AppLovinPrivacySettings");
			string str = isAgeRestrictedUser ? "true" : "false";
			MonoBehaviour.print("Calling 'AppLovinPrivacySettings.setIsAgeRestrictedUser()' with argument: " + str);
			androidJavaClass.CallStatic("setIsAgeRestrictedUser", isAgeRestrictedUser, @static);
		}
	}
}
